<?php
registerTable("parents_relationship", new table_parents_relationship());

class table_parents_relationship extends Database
{

    public function __construct()
    {
        parent::__construct("parents_relationship");
    }
    public function fetch_by_uid($uid){
        return $this->fetch_all_assoc("`uid`=$uid","`childid`,`relationship`");
    }

    public function fetch_all_by_childid($childid)
    {
        return $this->fetch_assoc("`childid`='$childid'");
    }

    public function contain_child($uid, $parentid)
    {
       parent::fetch_all("`uid`=$parentid AND `childid`=$uid", "`uid`");
       return ! parent::isEmpty();
    }
}
?>